home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / mac / DirectX SDK / DXSDK / samples / Multimedia / Media / bumpshader4.vsh < prev    next >
Text File  |  2001-10-08  |  705b  |  58 lines

  1. vs.1.0
  2.  
  3. ;Constants 
  4. ;
  5. ;c0-c3 Object
  6. ;
  7. ;c4-c7 Projection
  8. ;
  9. ;c8-c11 Total matrix
  10. ;
  11. ;c12 - Light Direction (In World Space)
  12. ;
  13. ;Input
  14. ;
  15.  
  16. ;V0 - Position
  17. ;V7 - Texture 
  18. ;V3 - Normal
  19. ;V8 - Tangnet
  20.  
  21.  
  22. ;Take normal and tangnet into texture space first
  23. m3x3 r7,v8,c0
  24. m3x3 r8,v3,c0
  25.  
  26. ;Cross product
  27. mul r0,r7.zxyw,-r8.yzxw;
  28. mad r5,r7.yzxw,-r8.zxyw,-r0;
  29.  
  30. ;transform the light vector
  31. dp3 r6.x,r7,c12
  32. dp3 r6.y,r5,c12
  33. dp3 r6.z,r8,c12
  34.  
  35.  
  36.  
  37. ;bias around 128
  38. mad r6.xyz,-r6.xyz,c33,c33
  39.  
  40. ;this is also our texture coordinate
  41. ;on our basis
  42. mov oT1.xy,r6
  43. mov oT3.xy,r6
  44.  
  45. mov oD0.xyzw,r6.z
  46.  
  47.  
  48.  
  49. ;transform into projection space
  50. m4x4 oPos,v0,c8
  51. mov oT0.xy,v7
  52. mov oT2.xy,v7
  53.  
  54.  
  55.  
  56.  
  57.  
  58.